using System;
using System.Data;
using NCS.Library.Components.Providers;
using NCS.Module.CMS.Library.CMSPermisions;
using NCS.Module.CMS.Library.Contents;
using NCS.Module.CMS.Library.Distributions;
using NCS.Module.CMS.Library.Feed;
using NCS.Module.CMS.Library.Zones;
using NCS.Module.CMS.Library.Events;
using NCS.Module.CMS.Library.Sport;

namespace NCS.Module.CMS.Library.Providers
{
	public abstract class DataAccessProvider
	{
		private static DataAccessProvider objProvider;
		public static DataAccessProvider Instance()
		{
			if (objProvider != null) return objProvider;
			DataAccessProviderConfiguration objConfig = DataAccessProviderConfiguration.GetDataAccessProviderConfiguration();
			Provider provider = new Provider(objConfig.DefaultProvider, "NCS.Module.CMS.Library.Providers." + objConfig.DefaultProvider, ((Provider)objConfig.Providers[objConfig.DefaultProvider]).ConnectionString);
			objProvider = (DataAccessProvider) DataAccessProviderFactory.CreateDataAccess(provider);
			return objProvider;
		}
        public abstract DataTable GetPortalsByLang(string lang);

#region	Zone
        public abstract DataTable GetZones();
		public abstract DataTable GetZones(string zoneCollection);
		public abstract DataTable GetZones(int parentId, string lang);
        public abstract DataTable GetZones(int parentId, string portalid, string lang);
        public abstract DataTable GetZones(int parentId, int portalid, int typezonevalue, string lang);
        public abstract DataTable GetZonesVisbleInNavbar(string lang);
        public abstract DataTable GetZonesVisbleInNavbar(string lang, int portalid);
        public abstract DataTable GetZonesVisbleInTab(int parentid, string lang);
        public abstract DataTable GetZonesVisbleInTop(string lang);
        public abstract DataTable GetZonesVisbleInTop(string lang, int portalid);
        public abstract DataTable GetZonesVisbleInRightBottom(string lang);
        public abstract DataTable GetZonesVisbleInRightBottom(string lang, int portalid);
        public abstract DataTable GetZonesVisbleInLeftBottom(string lang);
		public abstract DataTable GetZonesDeployed(int contentId);
		public abstract void SetZonePriority(int zoneId, int priority);
		public abstract int GetZoneChildCount(int zoneId);
		public abstract int AddZone(ZoneInfo zone);
		public abstract void UpdateZone(ZoneInfo zone);
		public abstract void DeleteZone(int zoneId);
		public abstract ZoneInfo GetZone(int zoneId);
        public abstract string GetZoneNameByZoneID(int zoneid);
        public abstract int GetParentID(int zoneid);
#endregion

#region Content
        public abstract int AddContent(ContentInfo content);
        public abstract ContentInfo GetInfo(int contentID);
        public abstract DataTable GetVersionByContentId(int contentId);
        public abstract int AddContentVersion(ContentVersionInfo content);
        public abstract void UpdateContentVersion(ContentVersionInfo content);
        public abstract ContentVersionInfo GetInfoVersion(int versionID);
        public abstract DataTable GetContents();
        public abstract DataTable GetContents(int zoneId, int status, int userId);
        public abstract DataTable GetContents(int zoneId, int statusd);
        public abstract DataTable Distributions_GetTopViewInZone(int recordnumber, int zoneId);
        public abstract DataTable Distributions_GetContentByView(int numberrecord);
        public abstract DataTable Distributions_GetContentByView(int numberrecord, int portalid);
        public abstract DataTable Distributions_GetNewContent(int numberrecord);
        public abstract DataTable Distributions_GetNewContent(int numberrecord, string portalid);
        public abstract void DeleteContent(int contentId);
        public abstract void DeleteContentVersion(int contentVersionid);
        public abstract void SetContentStatus(int contentId, int status);
        public abstract void SetContentComment(int contentId, string comment);
	    public abstract bool RemoverInZoneID(int contentID, int zoneID);
        public abstract void UpdatePostDate(DistributionInfo _distinfo);
        public abstract void UpdateContent(ContentInfo _contentInfo);
        public abstract void Version_SetVersionRollback(int versionid, int versionbefore);
        public abstract int Version_GetVersionUsedNow(int contentid);
        public abstract int Version_GetVersionRollback(int contentid);
        public abstract DataTable Distributions_GetPicInAlbumByContentId(int contentid);
        public abstract ContentInfo GetContent(int contentId);
        public abstract void LockContent(int contentId, int userId);
        public abstract void UnLockContent(int contentId);
#endregion

#region Distribution
        public abstract int AddDistribution(DistributionInfo distribution);
	    public abstract int GetDistID(int ContentID);
        public abstract DataTable GetDistributedContents(int zoneId, int top, int? rank);
        public abstract DataTable GetDistributedContentsByZone(int zoneId);
        public abstract DistributionInfo GetDistributedContentsByZone(int zoneId, DateTime date);
        
        public abstract DataTable GetDistributedContents(int zoneId, int top, int rank, DateTime date);
        public abstract DataTable GetDistributedContents(int zoneId, int userid);
        public abstract DataTable GetDistributedContents(int zoneId);

        public abstract DataTable GetContentsBySeftZoneIDAndRank(int zoneId, int top, int rank);
        public abstract DataTable GetDistributedRightContents(int zoneId, int top, bool bol);
        public abstract DataTable GetDistributedHotNewsContents(int zoneId, int top);
        public abstract DataTable GetDistributedHotNewsContentsbyPortal(int portalid, int top);
	    
        public abstract DataTable SearchForWeb(int pagesize, int curpage, out int totalrecord, string text);
        public abstract DataTable SearchForWebAdvance(int pagesize, int curpage, out int totalrecord, string text, int zoneid);
        public abstract DataTable SearchForWebAdvance(int portalid, int pagesize, int curpage, out int totalrecord, string text, int zoneid);
        public abstract DataTable Search(int pagesize, int distid, out int totalrecord, string text, bool curpage);
		public abstract void SetDistributionPriority(int distId, int priority);
		public abstract void SetDistributionRank(int distId, int rank);
		public abstract void UpdateDistributionView(int distId, int number);
        public abstract void SetDistributionView(int distId, int number);
        public abstract void DeleteDistribution(int distId);
		public abstract void DeleteDistribution(int contentId, int zoneId);
		public abstract DistributionInfo GetDistribution(int distId);
		public abstract DataTable GetOldDistributedContent(int curContentId, int numberRecord);
		public abstract DataTable GetNewDistributedContent(int curContentId, int numberRecord);
        public abstract DataTable GetNewContentByZoneIDAndRank(int zoneID, bool inZone, int pageSize, int currentPage, out int totalRecord);
        public abstract DataTable Distributions_Search(int zoneid, int userid, string text, string lang, int portalid, DateTime fromdate, DateTime todate, string rank);
#endregion

#region CMS Permision
        public abstract bool CheckUserPermision(int userId, int permision, int portalid);
		public abstract void UpdateUserPermision(int userId, int permision, string zoneCollection, int portalid);
		public abstract void RemoveUserPermision(int userId, int portalid);
        public abstract string GetPermisionZones(int userId, int portalid);
        public abstract CMSPermisionInfo GetPermisionInfo(int userId, int portalid);
#endregion

#region CMS_Event
        public abstract DataTable EventGetAll();
        public abstract DataTable EventGetAllByNum(int num);
        public abstract void SetPriority(int eventid, int newPriority);
        public abstract void Event_SetDistributionPriority(int eventid, int distid, int newPriority);
        public abstract int Event_GetEventIDByDistID(int distid);
        public abstract DataTable Event_GetNewsByEventID(int eventid, int numberRecord);
        public abstract DataTable Event_GetNewsByEventIDExcludeDistID(int eventid, int numberRecord, int distid);
        public abstract EventInfo Event_GetInfo(int eventid);
        public abstract EventInfo Event_GetEventInfoByDistID(int distid);
        public abstract void Event_AddDistribution(int eventID, int distid);
        public abstract void Event_RemoveDistribution(int eventID, int distid);
        public abstract void Event_Delete(int eventID);
        public abstract int Event_Insert(EventInfo einfo);
        public abstract void Event_Update(EventInfo einfo);
#endregion

#region Feed
        public abstract DataTable CategoryGetAll();
        public abstract FeedCatalogInfo CategoryInfo(string categoryid);
        public abstract int AddFeedContentToMSN(FeedContentInfo feedcontent);
        public abstract FeedContentInfo GetFeedInfo(string feedId);
        public abstract DataTable GetFeedContents(string categoryid, int pagesize, int curpage, out int totalrecord, string text, DateTime fromdate, DateTime todate, bool chkdeploy);
        public abstract void ContentDelete(string contentid);
        public abstract void UpdateMoved(string id);
#endregion

#region Sport
        public abstract int SoccerSeason_Insert(SoccerSeasonInfo season);
        public abstract void SoccerSeason_Delete(int season_ID);
        public abstract SoccerSeasonInfo SoccerSeason_GetInfo(int season_id);
        public abstract DataTable SoccerSeason_GetAll(bool status);
        public abstract void SoccerSeason_Update(SoccerSeasonInfo si);
        public abstract void SoccerSeason_SetStatus(int seasonid, bool status);
        public abstract void SoccerSeason_SetPriority(int seasonid, int index);

        public abstract int Match_Insert(MatchSchedule ms);
        public abstract void Match_Delete(int matchid);
        public abstract MatchSchedule Match_GetInfo(int matchid);
        public abstract DataTable Match_GetAll(int seasonid, bool status);
        public abstract void Match_Update(MatchSchedule ms);
        public abstract void MatchSchedule_SetPriority(int matchid, int index);
        public abstract void MatchSchedule_SetStatus(int matchid, bool status);
#endregion
    }
}
